package TryCatch;

public class Test {
	/**
	* @param args add by zxx ,Dec 9, 2008
	*/
	static int x = 1;
	public static void main(String[] args) {
		
	System.out.println(new Test().test());
	 System.out.println("f:"+x+"f:"+System.currentTimeMillis()); 
	}
	static int test()
	{
	
	try{
		x=x/0;
	    System.out.println("@"+x+"@:"+System.currentTimeMillis()); //出现异常不被执行
	    return x;                                                  //出现异常不被执行
	}catch (Exception e) {
		try {
			new Thread().sleep(1000);
		} catch (InterruptedException e1) {
			e1.printStackTrace();
		}
		System.out.println("#:"+x+"#:"+System.currentTimeMillis());
		System.out.println(e);//出现异常先执行
		return ++x;  //
	}finally{
		 System.out.println("$:"+x+"$:"+System.currentTimeMillis()); //依次执行
      	  ++x;
	     System.out.println("$:"+x+"$:"+System.currentTimeMillis());  
	}
	
	}
	
	}
   //结果：
			/*  #:1#:1366804689325
			    java.lang.ArithmeticException: / by zero
				$:2$:1366804689326
				$:3$:1366804689326
				2   //不知道从哪儿打印的
				f:3f:1366804689326
		    */